﻿<%@ Page Language="C#" %>

<script runat="server">
    void Page_Load(object sender, EventArgs e)
    {
        string actionnode_guid = Request["action"];

        if (actionnode_guid == null || !actionnode_guid.IsGuid())
        {
            InvalidAction.Visible = true;
            return;
        }

        Guid node_id = new Guid(actionnode_guid);
        Node node = NodeService.GetNodeForId(node_id);

        ActionNode actionNode = ActionService.GetActionNodeForNode(node);

        if (!actionNode.CurrentUserHasPermission())
        {
            AccessDenied.Visible = true;
            return;
        }

        Control control = Page.LoadControl(actionNode.Control);
        form.Controls.Add(control);
    }
</script>

<html>
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form" runat="server">
        <asp:Panel ID="InvalidAction" runat="server" Visible="false">Invalid Action</asp:Panel>
        <asp:Panel ID="AccessDenied" runat="server" Visible="false">Access Denied</asp:Panel>
    </form>
</body>
</html>
